package com.cty.service.impl;

import com.cty.mapper.RoleMapper;
import com.cty.pojo.EasyUIDatagrid;
import com.cty.pojo.Role;
import com.cty.service.RoleService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Auther: cty
 * @Date: 2020/4/1 15:40
 * @Description:
 * @version: 1.0
 */
@Service
public class RoleServiceImpl implements RoleService {
    Logger log = Logger.getLogger(RoleServiceImpl.class);

    @Resource
    private RoleMapper roleMapper;

    @Override
    public EasyUIDatagrid showRole(int PageNumer, int PageSize) {
        EasyUIDatagrid datagrid = new EasyUIDatagrid();
        datagrid.setRows(this.roleMapper.selByPage(PageSize*(PageNumer-1),PageSize));
        datagrid.setTotal(this.roleMapper.selCount());
        log.info("查询角色信息："+datagrid);
        return datagrid;
    }

    @Override
    public int updRole(Role role) {
        return this.roleMapper.updRole(role);
    }
}
